package com.android.djlmapp.dialog;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import android.widget.TextView;

import com.android.djlmapp.R;
import com.android.djlmapp.model.my.DuiZhangInfo;
import com.android.djlmapp.model.my.JiaKuanInfo;

import razerdp.basepopup.BasePopupWindow;

public class DuiZhangPopup extends BasePopupWindow {
    public static final String TAG = "djlm-my: ";

    public static String order_sn, money, time, note;

    public DuiZhangPopup(Context context) {
        super(context);
        Log.i(TAG, "order_sn0: "+order_sn);

    }

    public static void setInfo(DuiZhangInfo.DataBean item){
        order_sn = item.getTrade_id();
        time = item.getData_time();
        money = item.getMoney();
        note = item.getContent();
    }

    // 必须实现，这里返回您的contentView
    // 为了让库更加准确的做出适配，强烈建议使用createPopupById()进行inflate
    @Override
    public View onCreateContentView() {
        Log.i(TAG, "order_sn: "+order_sn);
        View view = createPopupById(R.layout.dialog_dz);

        TextView title = view.findViewById(R.id.dz_title);
        title.setText("对账详情");

        TextView dz_name = view.findViewById(R.id.dz_name);
        dz_name.setText("订单编号:");
        TextView dz_name_v = view.findViewById(R.id.dz_name_v);
        dz_name_v.setText(order_sn);

        TextView dz_money = view.findViewById(R.id.dz_money);
        dz_money.setText("交易金额:");
        TextView dz_money_v = view.findViewById(R.id.dz_money_v);
        dz_money_v.setText(money);

        TextView dz_time = view.findViewById(R.id.dz_time);
        dz_time.setText("加款时间:");
        TextView dz_time_v = view.findViewById(R.id.dz_time_v);
        dz_time_v.setText(time);

        TextView dz_result = view.findViewById(R.id.dz_result);
        dz_result.setText("交易说明:");
        TextView dz_result_v = view.findViewById(R.id.dz_result_v);
        dz_result_v.setText(note);

        return view;
    }

    // 以下为可选代码（非必须实现）
    // 返回作用于PopupWindow的show和dismiss动画，本库提供了默认的几款动画，这里可以自由实现
    @Override
    protected Animation onCreateShowAnimation() {
        return getDefaultScaleAnimation(true);
    }

    @Override
    protected Animation onCreateDismissAnimation() {
        return getDefaultScaleAnimation(false);
    }
}
